home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
param10
/
jmparam.txt
< prev
next >
Wrap
Text File
|
1995-08-23
|
4KB
|
111 lines
A major ommission in Visual Basic is the inability to pass parameters
to forms. Generally this is handled by using global variables or
assigning values to controls on a form. Neither is very satisfactory
since you have the problem of synchonization: How do you load two
forms of the same type at the same time?
In addition you do not get event notification using global
variables. In VB programming you want the form to be able to get
data AND to know when data is available.
The VisualWare Parameter control allows you exchange data with
a form and to notify a form of events. In effect it gives you the
ability to call a function in a form.
To use the Parameter Control:
1. Include JMPARAM.VBX in your project.
2. Include JMPARAM.BAS in your project.
3. Place a Parameter Control on the forms you want to call.
4. Add code to process CallForm events for your parameters controls.
To 'call' a form use the CallForm function that is described below.
Standard Properties
-------------------
Name
Left
Type
Parent
Hwnd
Custom Properties
-------------------
The ArgCount and Argument properties are only valid while processing
a CallForm event. If accessed at any other time an error occurs.
ArgCount: The number of parameters passed to CallForm event. This
is the size of the Argument property array. This properties is read
only.
Argument: The arguments passed to the CallForm event. This is a
property array Argument (1) is the first element and the ArgCount
property gives the index for the last element. This property
is read/write so you can return values to the calling procedure.
Event
-----
CallForm (CallType as integer, ReturnValue as Long)
This event is generated when you call the CallForm function. CallType
is passed directly from the CallForm function. It is not interpreted in
any way. ReturnValue is the value returned by the CallForm function
calling the form.
Within the CallForm event (or any functions or subroutines called
from the CallForm event) you can access the Argument and ArgCount
properties of the parameter control. You can update the values
of the Argument() properties to return values to the caller.
Calling a Form
--------------
Use the CallForm function to call a form. The exact definition of the
function is in JMPARAM.BAS. This is a summary.
function CallForm (Frm as Form, CallType as Integer, Args () as string) as long
Parameters:
Frm: The form you want to call. If the form you specify does not
have a parameter control no error occurs and the return value is unpredictable.
CallType: This value is passed to the form. It is not interpreted in any
way. You can use this value to specify different actions for the form
to take.
Args(): A string array of arguments to pass to the form. The form can
update this array. You can specify any array bounds however the
form always sees the first element in the array as one.
Return Value: The return value is set in the CallForm event.
Restrictions
------------
1. You can only place one Parameter Control on a form.
2. The Parameter control supports up to four nested calls. However
any calls after the fourth are ignored and CallForm returns -1.
3. Do not unload the form containing a Parameter Control during the
call FormEvent.
The sample application shows how the Parameter Control can be used to
exchange data among forms.
Send Problem Reports to
visualware@interramp.com
VisualWare, Inc.
1675 East Main St, Suite 218
Kent OH 44249
(216) 258-9012